import request from '@/config/axios'
import type { PageParam } from '@/types/global'

export interface Favorite {
  id?: number
  userId?: string // 用户编号
  spuId?: number | null // 商品 SPU 编号
}

// 获得 ProductFavorite 列表
export const getFavoritePage = (params: PageParam) => {
  const finalParams = { ...params, productType: 'SHOP' };
  return request.get({
    url: '/product/favorite/page',
    params: finalParams
  })
}

// 删除商品收藏
export const deleteFavorite = (id: number) => {
  const url = `/product/favorite/delete?id=${id}&productType=SHOP`;
  return request.delete({ url })
}
